home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / winprogs / faq next >
Text File  |  1993-12-08  |  15KB  |  363 lines

  1.              Frequently Asked Questions About
  2.             Windows Sockets Version 1.1
  3.                    08 Dec 1993
  4.  
  5.   This FAQ has been put together by Mark Towfiq, with much-appreciated
  6. assistance from Jay Allard, Bruce Backman, Paul Brooks, Martin Hall,
  7. Simon Hewison, Mike Morse, Bob Quinn, Ed Schwalenberg, Bill Tang, Dave
  8. Treadwell, and Fred Whiteside.  If you have any modifications to this
  9. FAQ, send them to towfiq@East.Sun.Com, and I will fold them into the
  10. next revision.
  11.  
  12.   First of all, the questions:
  13.  
  14. 1.    What is Windows Sockets?
  15. 2.    What is the latest version?
  16. 3.    When is the next rev of the specification?  Why not sooner?
  17. 4.    Where can I get a/the WINSOCK.DLL?
  18. 5.    Why isn't there just one WINSOCK.DLL?  Do I need a TCP/IP already to
  19.       use it?
  20. 6.    Where can I contact Windows Sockets application and implementation
  21.       vendors?  (include list of address, phone contacts)
  22. 7.    Where can I get sample apps and tests?
  23. 8.    Will Windows Sockets be in _____?
  24. 8.1.  Will Windows Sockets be in Windows NT?
  25. 8.2.  Will Windows Sockets be in Windows for Workgroups?
  26. 8.3.  Will Windows Sockets be in DOS?
  27. 8.4.  Will Windows Sockets be in Unix?
  28. 8.5.  Will Windows Sockets be in Win32s?
  29. 9.    What about standard APIs for ____?
  30. 9.1.  What about standard APIs for FTP?
  31. 9.2.  What about standard APIs for Telnet?
  32. 9.3.  What about standard APIs for SNMP?
  33. 9.4.  What about standard APIs for RPC?
  34. 9.5.  What about standard APIs for TLI/XTI?
  35. 10.1. Does Windows Sockets work over protocols other than TCP/IP?
  36. 10.2. Will it?
  37. 11.   Why no SOCK_RAW?
  38. 12.   Why isn't it possible to share sockets between tasks?
  39. 13.1. How do I get my IP address?
  40. 13.2. Why no SIOCGIFADDR?
  41. 14.   When should I use blocking vs. nonblocking sockets?
  42. 15.   What about other socket options that BSD supports?  Ioctls?
  43. 16.   How can I get the local username?
  44. 17.   Do I need to initialize the WSAData structure before calling
  45.       WSAStartup?
  46. 18.   If I write a Windows Sockets program for DOS, will I be able to
  47.       communicate with a Sockets program on UNIX?
  48. 19.   Is it possible to create sockets that map to a dll rather than an
  49.       application?  I have tried a WSAStartup() as part of my LibMain, but
  50.       the sockets that are created are owned by the application, not by the
  51.       DLL. It would be desirable for me to have some of the sockets that
  52.       are opened have "A Global (DLL wide) Scope".
  53. 20.   A *Class* of questions that could be answered are related to porting
  54.       extant BSD applications to Windows Sockets: "How to I implement the
  55.       xxxx function call in my Windows Sockets application?" (e.g. fcntl(),
  56.       readv(), etc).
  57. 21.   Is there a Pascal/Visual Basic/Visual Cobol header file for Windows
  58.       Sockets?
  59. ----------------------------------------------------------------------
  60. 1.  What is Windows Sockets?
  61.  
  62. Answer: The Windows Sockets specification defines a network programming
  63. interface for Microsoft Windows which is based on the "socket" paradigm
  64. popularized in the Berkeley Software Distribution (BSD) from the University
  65. of California at Berkeley.  It encompasses both familiar Berkeley socket
  66. style routines and a set of Windows-specific extensions designed to allow
  67. the programmer to take advantage of the message-driven nature of Windows.
  68.  
  69. The Windows Sockets Specification is intended to provide a single API to
  70. which application developers can program and multiple network software
  71. vendors can conform.  Furthermore, in the context of a particular version
  72. of Microsoft Windows, it defines a binary interface (ABI) such that an
  73. application written to the Windows Sockets API can work with a conformant
  74. protocol implementation from any network software vendor.  This
  75. specification thus defines the library calls and associated semantics to
  76. which an application developer can program and which a network software
  77. vendor can implement.
  78.  
  79. Network software which conforms to this Windows Sockets specification will
  80. be considered "Windows Sockets Compliant".  Suppliers of interfaces which
  81. are "Windows Sockets Compliant" shall be referred to as "Windows Sockets
  82. Suppliers".  To be Windows Sockets Compliant, a vendor must implement 100%
  83. of this Windows Sockets specification.
  84.  
  85. Applications which are capable of operating with any "Windows Sockets
  86. Compliant" protocol implementation will be considered as having a "Windows
  87. Sockets Interface" and will be referred to as "Windows Sockets
  88. Applications".
  89.  
  90. 2.  What is the latest version?
  91.  
  92. Answer: The latest version of the specification is 1.1.
  93.  
  94. 3.  When is the next rev of the specification?  Why not sooner?
  95.  
  96. Answer: The next rev. (2.0) will not be until towards the end of 1993.  We
  97. need 1.1 of the API to become firmly settled and implemented first.
  98.  
  99. 4.  Where can I get a/the WINSOCK.DLL?
  100.  
  101. Answer: You can most probably get one from the same place you got your
  102. TCP/IP software from.
  103.  
  104. 5.  Why isn't there just one WINSOCK.DLL?  Do I need a TCP/IP already
  105.     to use it?
  106.  
  107. Answer: The Windows Sockets specification defines the top level of the DLL,
  108. the part which is called by user programs.  The method a given WINSOCK.DLL
  109. will use to access TCP/IP (or NetWare, or AppleTalk, or DECNet ...) depends
  110. on the networking package you have installed, and therefore must vary.  A
  111. WINSOCK.DLL is therefore just an interface to whatever existing protocol
  112. you already have installed.  An illustration would help:
  113.  
  114.        +---------------------------------+
  115.        |  WinSock compliant application  |
  116.        +---------------------------------+
  117.        +---------------------------------+ <--- WinSock API
  118.        |       Windows Sockets DLL       |
  119.        +---------------------------------+
  120.        +---------------------------------+ <--- Protocol Stack API
  121.        |   Protocol Stack (e.g. TCP/IP)  | (typically proprietary)
  122.        +---------------------------------+
  123.        +---------------------------------+ <--- Hardware Driver API
  124.        |        Hardware Driver          |   (Packet Driver, NDIS, ODI,
  125.        +---------------------------------+    or proprietary)
  126.        +---------------------------------+ <--- Hardware Interface
  127.        |   Network (hardware) Interface  |    (hardware specific)
  128.        +---------------------------------+
  129.                        |
  130.                        +----> network
  131.  
  132. 6.  Where can I contact Windows Sockets application and implementation
  133. vendors?  (include list of address, phone contacts)
  134.  
  135. Answer:
  136.  
  137.     Date: Tue, 6 Apr 93 12:53:37 PDT
  138.     From: tang@documentum.com (Bill Tang)
  139.     To: winsock@Microdyne.COM
  140.     Subject: vendor list (long)
  141.  
  142.     Thanks to all that responded to my previous inquiry of vendor
  143.     implementations. I am posing a summary and will keep the list updated
  144.     if I receive more information.
  145.     -------------------------------------------------------------------------
  146.     SUMMARY
  147.     -------------------------------------------------------------------------
  148.              (old list at 11/23/92)
  149.     Company              BETA    FINAL    Update (4/6/93)
  150.     -------------------------------------------------------------------------
  151.     3Com Corp            Q1'93  Q2'93    ?
  152.     Beame & Whiteside    Q2'93  Shipping    Shipping v1.1 DLL with stack
  153.     Distinct Corp        Q3'92  Shipping    ?
  154.     FTP Software         Q4'92  Shipping    shipping v1.1 TCP/IP stack
  155.                         with DLL; DLL
  156.                         available on BBS or
  157.                         anonymous-ftpable on
  158.                         vax.ftp.com;
  159.                         Development Kit being
  160.                         updated to include
  161.                         v1.1 Windows Sockets
  162.                         support.
  163.  
  164.     Frontier Tech        Q3'92  Shipping    ?
  165.     IBM                  Q4'92  Q1'92        ?
  166.     JSB Corporation      Q4'92  Q4'92        ?
  167.     Lan Design           Q4'92  Q1'93        ?
  168.     Lanera Corp                    Shipping v1.1 TCP/IP stack
  169.     Microdyne            Q4'92  Q1'93        ?
  170.     Microsoft(W NT 32b)  Q3'92  Q2'93        Win32 SDK March release 
  171.     Microsoft(W NT 16b)  Q4'92  Q2'93        Win32 SDK March release 
  172.     Microsoft(W 3.x 16b) Q4'92  Q2'93        ?
  173.     NetManage            Q4'92  Q4'92        shipping v1.1 DLL
  174.     Network Research      ?       ?        ?
  175.     Novell                ?       ?        ?
  176.     Spry                    (stack) supports Winsock v1.1
  177.     Sun Microsystems     Q4'92  1stHalf'93    ?
  178.     Ungermann Bass        ?       ?        v1.1 TCP/IP stack and DLL: 
  179.                             Beta Q1'93, Final Q2'93
  180.     Walker Richer Quinn  Q4'92  Q1'93    ?
  181.     Wollongong           Q4'92  Q1'93    ?
  182.  
  183. 7.  Where can I get sample applications and tests?
  184.  
  185. Answer: Files and information related to the Windows Sockets API are
  186. available via FTP (user: "anonymous", password: your e-mail address)
  187. on the host SunSite.UNC.EDU, in /pub/micro/pc-stuff/ms-windows/winsock.
  188. Note: if you do not have FTP access to the Internet, send a message
  189. with the word "help" in the body to either ftpmail@SunSite.UNC.Edu, or
  190. ftpmail@DECWRL.DEC.Com (in the UK mail to ftpmail@doc.ic.ac.uk), to
  191. obtain information about the FTP to Mail service there.
  192.  
  193. 8.  Will Windows Sockets be in _____?
  194.  
  195. 8.1.  Will Windows Sockets be in Windows NT?
  196.  
  197. Answer: Yes.  In 16 and 32-bit versions.
  198.  
  199. 8.2.  Will Windows Sockets be in Windows for Workgroups?
  200.  
  201. Answer: Yes.
  202.  
  203. 8.3.  Will Windows Sockets be in DOS?
  204.  
  205. Answer: Paul Brooks of TurboSoft (paul@abccomp.oz.au) tells me:
  206.  
  207.     As for a Windows Sockets for DOS - we have a library that is
  208.     pretty much complete. The goal was to produce a DOS library and
  209.     Binary API which would allow developers to code applications using
  210.     the Windows Sockets 1.1 spec. and have it run exactly the same
  211.     under DOS as Windows - blocking and non-blocking modes,
  212.     Asynchronous calls, the works. Apart from some AsyncGetXXXbyYYY
  213.     calls the rest works, although it is not possible to capture all
  214.     the Windows-specific semantics of some areas.
  215.  
  216. I am sure you can contact him for more information.  JSB also has a
  217. standardized Berkeley Sockets API for DOS which provides access to all
  218. TCP/IP implementations.
  219.  
  220. 8.4.  Will Windows Sockets be in UNIX?
  221.  
  222. Answer: Well, since it came from BSD UNIX, there's not much need.
  223.  
  224. 8.5.  Will Windows Sockets be in Win32-S?
  225.  
  226. Answer: Yes, Win32s 1.1 contains a thunking layer that converts 32-bit
  227. Windows Sockets calls to 16-bit Windows Sockets.  It should work on
  228. top of any 16-bit WINSOCK.DLL.
  229.  
  230. 9.  What about standard APIs for ____?
  231.  
  232. 9.1.  What about standard APIs for FTP?
  233.  
  234. Answer: Not yet.
  235.  
  236. 9.2 What about standard APIs for Telnet?
  237.  
  238. Answer: Not yet.
  239.  
  240. 9.3 What about standard APIs for SNMP?
  241.  
  242. Answer: In the works.  Send e-mail to listserv@SunSite.UNC.EDU with
  243. "subscribe winsnmp" in the body of the message to join the list.
  244.  
  245. 9.4 What about standard APIs for RPC?
  246.  
  247. Answer: Microsoft will be providing an implementation of DCE RPC.  Also in
  248. the works is the definition of a standard implementation of ONC RPC (known
  249. as RPC for Windows) which will be made available by multiple vendors.  To
  250. contribute to the discussion, send email to rpc4win@wco.ftp.com.
  251.  
  252. 9.5 What about standard APIs for TLI/XTI?
  253.  
  254. Answer: No, not yet.  Vendors chose to do Windows Sockets because of the
  255. sockets application and knowledge base, however anyone out there is free to
  256. try a Windows TLI/XTI Specification.
  257.  
  258. 10.1.  Does Windows Sockets work over protocols other than TCP/IP?
  259.  
  260. Answer: Yes, it does.  But we know of no vendors supplying one currently.
  261.  
  262. 10.2.  Will it?
  263.  
  264. Answer: Yes.  Windows NT will include mechanisms for multiple protocol
  265. support in Windows Sockets, both 32-bit and 16-bit.
  266.  
  267. 11.  Why no SOCK_RAW?
  268.  
  269. Answer: SOCK_RAW is optionally implemented by many major Windows Sockets
  270. vendors.  It is not mandated now because: 1) not every stack vendor can
  271. supply a complete SOCK_RAW interface, and 2) we did not have time to define
  272. the minimal subset every vendor could provide (e.g. maybe just ICMP).
  273.  
  274. 12.  Why isn't it possible to share sockets between tasks?
  275.  
  276. Answer: The real answer is that it wasn't considered sufficiently important
  277. for 1.1, but is high on the list for inclusion in 2.0.
  278.  
  279. 13.1.  How do I get my IP address?
  280.  
  281. Answer: Do a gethostbyname() on the output from gethostname().
  282.  
  283. 13.2.  Why no SIOCGIFADDR?
  284.  
  285. Answer: It was not included because there were concerns it could not be
  286. supported across platforms.  It may be included in version 2.0 of the spec.
  287.  
  288. 14.  When should I use blocking vs. non-blocking sockets?
  289.  
  290. Answer: Try to use non-blocking sockets whenever possible; certainly if you
  291. are coding a Windows application from scratch.  Blocking sockets should
  292. only be used when trying to maintain portability between UNIX/MS-DOS and
  293. Windows.
  294.  
  295. 15.  What about other socket options that BSD supports?  Ioctls?
  296.  
  297. Answer: Some vendors may support them.  Do not rely on ones not explicitly
  298. mentioned in the specification, however.
  299.  
  300. 16.  How can I get the local username?
  301.  
  302. Answer: Based on a suggestion from Simon Hewison
  303. (p0063886@cs3.oxford-brookes.ac.uk), one idea is to call WNetGetUser()
  304. in the NETWORK.DRV.  If a vendor has supplied a NETWORK.DRV then this
  305. will work, if not you can just use some other method.  Thus you could
  306. write a bit of code thus:
  307.  
  308.     WNetGetUser(szNetUserId,sizeof(szNetUserId);
  309.     if (strlen(szNetUserId)==0) {
  310.         /* call some other method of getting
  311.            userid, eg. the lan manager call NetWkstaGetInfo */
  312.     }
  313.  
  314.   Information on this API call is in the Windows Device Driver Adaption
  315. Guide.
  316.  
  317. 17.  Do I need to initialize the WSAData structure before calling
  318. WSAStartup?
  319.  
  320. Answer: No, WSAStartup does not retrieve the contents of the WSAData
  321. structure pointed to, it fills it in.
  322.  
  323. 18.  If I write a Windows Sockets program, will I be able to communicate
  324. with a Sockets program on UNIX or any other non Windows platform?
  325.  
  326. Answer: Absolutely!  This common question is the result of confusing
  327. protocols with the APIs; communicating programs need not have been
  328. created with the same APIs, as long as they are using the same
  329. (transport & network) protocols.
  330.  
  331. 19.  Is it possible to create sockets that map to a dll rather than an
  332. application?  I have tried a WSAStartup() as part of my LibMain, but the
  333. sockets that are created are owned by the application, not by the DLL. It
  334. would be desirable for me to have some of the sockets that are opened have
  335. "A Global (DLL wide) Scope".
  336.  
  337. Answer: The way this situation has been dealt with by developers is to have
  338. your DLL create a "helper process" which will perform all Windows Sockets
  339. operations on behalf of your applications (thereby having all sockets owned
  340. by the helper process' task).
  341.  
  342. 20.  A *Class* of questions that could be answered are related to porting
  343. extant BSD applications to Windows Sockets: "How to I implement the xxxx
  344. function call in my Windows Sockets application?" (e.g. fcntl(), readv(),
  345. etc).
  346.  
  347. Answer: In general, you will have to code such functions yourself, although
  348. it would not hurt to suggest them for the next revision of the
  349. specification as well.
  350.  
  351. 21.  Is there a Pascal/Visual Basic/Visual Cobol header file for Windows
  352. Sockets?
  353.  
  354. Answer: The Pascal and Visual Basic forms are already in the FTP
  355. archive.  Look there for any other header files that people may have
  356. developed so far.  It should be pointed out that not all the Winsock
  357. functions can be called from Visual Basic and the subset that can be
  358. called are not really enough for a true app (for example, you can't
  359. call gethostbyname()).  To use Winsock from VB requires a translation
  360. DLL that will probably have to be written in C.  To date, there is no
  361. public domain implementation, although several vendors have announced
  362. toolkits for Winsock for VB.
  363.